/* @(#)ProductTypeManager.java    V1.0
 *
 * Project: APEP 
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   ��ة��    {CREATE_TIME} First release
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2007 Auto-Parts E-Procurement Co., Ltd. 
 *        No.251-1 Wuning Road, Shanghai, 200063, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Auto-Parts E-Procurement Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with APEP.
 *
 * Warning:
 * =============================================================================
 *   
 * 
 */

package system.base;

import system.data.ProductTypeManagerBase;
import framework.core.*;

/*
	Author    :��ة��
	CreateTime:{CREATE_TIME}
*/
public class ProductTypeManager extends ProductTypeManagerBase 
{

//----system generated start----// 	
	private static final String SEQ_NAME = "S_PRODUCT_TYPE_MANAGER";
public ProductTypeManager() 
{
	
}

private static void delete(DBConnection con,String id) throws Exception
{
	Conditions conditions = new Conditions();

	conditions.add(ID,id);
	
	delete(con,TABLE_NAME,conditions);
}
public static ProductTypeManager fetch()
{
	return new ProductTypeManager();
}
public static ProductTypeManager copy(ProductTypeManager srcObj)
{
	ProductTypeManager obj = fetch();
	obj.copyBase(srcObj);
	return obj;
}
public static ProductTypeManager fetch(DBConnection con,String id) throws Exception
{
	Conditions conditions = new Conditions();

	conditions.add(ID,id);
	
	return fetch(con,conditions);
}

public static ProductTypeManager fetchByProductType(DBConnection con,String productType) throws Exception
{
	Conditions conditions = new Conditions();

	conditions.add(PRODUCT_TYPE,productType);
	
	conditions.add(UPPER_TYPE,"2000");
	
	return fetch(con,conditions);
}
public static ProductTypeManager fetch(DBConnection con,Conditions conditions) throws Exception
{
	DBResult result = null;
	try
	{
		result = DBEngine.doSelect(con,"select * from " + TABLE_NAME,conditions);
		java.sql.ResultSet rs = result.getRs();
		ProductTypeManager obj = null;
		if(rs.next())
		{
			obj = fetch(rs);
		}
		return obj;
	}
	finally
	{
		if(result!=null) result.clear() ;
	}
}
public static ProductTypeManager fetch(java.sql.ResultSet rs) throws Exception
{
	ProductTypeManager obj = new ProductTypeManager();
	obj.initObject(rs);
	return obj;
}
protected void getUnique(DBConnection con) throws Exception
{
	setId(DBEngine.getId(con));
}


//封装产品分类
public static ObjectList getUpperProductType(DBConnection con) throws Exception{

    Conditions conditions = new Conditions();

    conditions.add(" upper_type = 0");
    conditions.add(" status='1' order by product_type");
    ObjectList tManuf1 = ProductTypeManager.fetch().search(con, conditions);
    return tManuf1;
}

public static ObjectList getProductType(DBConnection con) throws Exception{

    Conditions conditions = new Conditions();

    conditions.add(" upper_type != 0");
    conditions.add(" status='1' order by product_type");
    ObjectList tManuf1 = ProductTypeManager.fetch().search(con, conditions);
    return tManuf1;
}

//获取产品使用分类列表   liuyiwei 20110819
public static ObjectList getProductTypeList(DBConnection con) throws Exception{

    Conditions conditions = new Conditions();

    conditions.add(" upper_type =1000");
    conditions.add(" status='1' order by product_type");
    ObjectList tManuf1 = ProductTypeManager.fetch().search(con, conditions);
    return tManuf1;
}

//获取产品招标分类列表   liuyiwei 20110819
public static ObjectList getBidTypeList(DBConnection con) throws Exception{

    Conditions conditions = new Conditions();

    conditions.add(" upper_type = 2000");
    conditions.add(" status='1' order by product_type");
    ObjectList tManuf1 = ProductTypeManager.fetch().search(con, conditions);
    return tManuf1;
}
//----system generated end----//

}

